// JavaScript Document
/*======================================
功能描述：工具栏按钮
版　　本：1.0
作　　者：王辉
最后修正：2006-10-25 11:40
=======================================*/
//禁止选取
document.onselectstart =function(){
	if(event.srcElement.type!="text"&&event.srcElement.type!="textarea"&&event.srcElement.type!="password"){
		return false;
	}
}

function setInit(){
	if(!document.all && !document.getElementById){
		return;
	}
	for(i=0;i<document.all.length;i++){
		var tempToolbar=document.all[i];
		try{
			if(tempToolbar.className!="toolbar"){
				continue;
			}
		}
		catch(e){
			continue;
		}
		tempToolbar.innerHTML+='<div class="toobar_disable" id="'+ tempToolbar.id +'_disable"></div>';
		//alert(tempToolbar.id);
		document.getElementById(tempToolbar.id+"_disable").onclick=tempToolbar.onclick;
		tempToolbar.onmouseover=function(){
			toolbarMouseOver(this);
		}
		tempToolbar.onmouseout=function(){
			toolbarMouseOut(this);
		}
		tempToolbar.onmousedown=function(){
			toolbarMouseDown(this);
		}
		tempToolbar.onmouseup=function(){
			toolbarMouseUp(this);
		}
		if(tempToolbar.disnable){
			Disnable(tempToolbar);
		}
	}
}
function toolbarMouseOver(theDiv){
	if(theDiv.disabled){
		return;
	}
	theDiv.style.borderLeftColor="#fff";
	theDiv.style.borderTopColor="#fff";
	theDiv.style.borderRightColor="#dbdee8";
	theDiv.style.borderBottomColor="#dbdee8";
}
function toolbarMouseOut(theDiv){
	if(theDiv.disabled){
		return;
	}
	theDiv.style.borderColor="#f1f3f8";
}
function toolbarMouseDown(theDiv){
	if(theDiv.disabled){
		return;
	}
	theDiv.style.borderLeftColor="#dbdee8";
	theDiv.style.borderTopColor="#dbdee8";
	theDiv.style.borderRightColor="#fff";
	theDiv.style.borderBottomColor="#fff";
}
function toolbarMouseUp(theDiv){
	if(theDiv.disabled){
		return;
	}
	theDiv.style.borderLeftColor="#fff";
	theDiv.style.borderTopColor="#fff";
	theDiv.style.borderRightColor="#dbdee8";
	theDiv.style.borderBottomColor="#dbdee8";
}
function Disnable(toolbar){
	toolbar.onclick=null;
	toolbar.disabled=true;
	toolbar.className="toolbar disabled";
}
function Enable(toolbar){
	toolbar.onclick=document.getElementById(toolbar.id+"_disable").onclick;
	toolbar.disabled=false;
	toolbar.className="toolbar";
}
window.attachEvent("onload",setInit)